package com.example.capsule_netty.listener;

import com.example.capsule_netty.global.UserAndChannelRelevance;
import com.example.capsule_netty.netty.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: zhuzhiming
 * @Date: 2022/4/27 19:18
 */
@Component
public class NettyServerApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    RedisTemplate<String,String> redisTemplate;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        NettyServer serverInstance = NettyServer.getInstance();
        serverInstance.start();

        redisTemplate.opsForValue().set("test-sign","2022");

    }
}
